<%@ page language="java"  pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="<s:url value="/style.css"/>" rel="stylesheet" type="text/css"/>
<title>Appointment List</title>
<style>
	#infoLeft {
		display:inline-block;
		width:100px;
		alignX:center;
		margin-right:30px;
	}
	#infoRight {
		display:inline-block;
		alignX:center;
	}
	#paitentInfo {
		align:left;
	}
	h3 {
		alignX:left;
	}
	#appointmentTable td {
		text-align:center;
	}
	
</style>
</head>
<body>
	<jsp:include page="/navigation/navigation.jsp"/>
	<div id="mainBox">
		<center><h2>Appointment List</h2></center>
			
			<center>
			<div>
				
				<h3>Appointments:</h3>
					<table id="appointmentTable">
					<col width="120" />
					<col width="50" />
					<col width="100" />
					<col width="100" />
					<col width="120" />
					<col width="120" />
					<s:if test='actionMode=="showStaffAppointment"'>
						<col width="100" />
						<col width="100" />
					</s:if>
						<thead>
							<tr>
								<th>Patient</th>
								<th>Date</th>
								<th>StartTime</th>
								<th>EndTime</th>
								<th>Doctor</th>
								<th>Location</th>
								<th>Details</th>
								<s:if test='actionMode=="showStaffAppointment"'>
									<th>Edit</th>
									<th>Delete</th>
								</s:if>
							</tr>
						</thead>
						<tbody>
							<s:iterator value="retrievedAppointments">
							<tr>
								<td><s:property value="patient.name" /></td>
								<td><s:property value="appointmentDate" /></td>
								<td><s:property value="startTime" /></td>
								<td><s:property value="endTime" /></td>
								<td><s:property value="doctor.name" /></td>
								<td><s:property value="location" /></td>
								<td><a href="<s:url action='initAppointmentViewPage'><s:param name="selectedAppointmentId" value="%{appointmentId}" /></s:url>">details</a></td>
								<s:if test='actionMode=="showStaffAppointment"'>
									<td><a href="<s:url action='initAppointmentUpdatePage'>
									<s:param name="selectedAppointmentId" value="%{appointmentId}" />
									<s:param name="currentEmployeeId" value="#session.currentUser.id" />
									</s:url>">edit</a></td>
									<td><a href="<s:url action='deleteAppointment'>
									<s:param name="selectedAppointmentId" value="%{appointmentId}" />
									<s:param name="currentEmployeeId" value="#session.currentUser.id" />
									</s:url>">cancel</a></td>
								</s:if>
							</tr>
							</s:iterator>
						</tbody>
	
					</table>
					</div>
			</center>
	</div>
</body>
</html>